import { request, post, get } from "@/utils/request";
import ApiResult from "@/api/base/ApiResult";
import {
  positionAdd,
  positionUpdate,
  positionDel,
  positionDetail,
  positionQuery,
} from "@/api/modules/orgPosition";

/**
 * 获取职务列表
 * @returns {promise} Promise
 */
export async function pageList(data: positionQuery) {
  const rs: ApiResult<any> = await request(`merchant/role/pageList`, data);
  return rs;
}
/**
 * 新增职务
 * @returns {promise} Promise
 */
export async function addNew(data: positionAdd) {
  const rs: ApiResult<any> = await request("merchant/role/addNew", data);
  return rs;
}
/**
 * 更新职务
 * @returns {promise} Promise
 */
export async function update(data: positionUpdate) {
  const rs: ApiResult<any> = await request("merchant/role/update", data);
  return rs;
}
/**
 * 详情职务
 * @returns {promise} Promise
 */
export async function detail(data: positionDetail) {
  const rs: ApiResult<any> = await request("merchant/role/detail", data);
  return rs;
}
/**
 * 删除职务
 * @returns {promise} Promise
 */
export async function del(data: positionDel) {
  const rs: ApiResult<any> = await request("merchant/role/delete", data);
  return rs;
}
/**
 * 全部职务
 * @returns {promise} Promise
 */
export async function allRole() {
  const rs: ApiResult<any> = await request("merchant/role/simpleList", {});
  return rs;
}
/**
 * 权限树
 * @returns {promise} Promise
 */
export async function normalTree() {
  const rs: ApiResult<any> = await request("merchant/permi/normalTree", {});
  return rs;
}

/**
 * 查询应用接口
 * @returns {promise} Promise
 */
export async function queryAppList(data: {simple: boolean; includeMerchant: boolean}): Promise<ApiResult<any>> {
  return request("merchant/serviceModule/queryList", data);
}